"""
URL configuration for Zdemo1 project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.urls import path
from py_web.user.views.UserViews import *
from py_web.user.views.RoleMenuViews import *
from py_web.user.views.MenuViews import *
from py_web.user.views.RoleViews import *


urlpatterns = [
    # 用户
    path("users/", UserView.as_view({
        "get": "list",
        "post": "create",
    }), name="user"),
    path("users/<int:pk>/", UserView.as_view({
        "get": "retrieve",
        "put": "update",
        "delete": "destroy",
    }), name="user"),

    path("updateUserStatusView/", UpdateUserStatusView.as_view(), name="修改状态"),
    path("deleteUserView/", DeleteUserView.as_view(), name="删除user以及关联角色关系"),

    # 角色
    path("role/", RoleView.as_view({
        "get": "list",
        "post": "create",
    }), name="roleMenu"),
    path("role/<int:pk>", RoleView.as_view({
        "get": "retrieve",
        "put": "update",
        "delete": "destroy",
    }), name="roleMenu"),

    path("role/listAllRole/", ListAllRoleView.as_view(), name="获取角色列表"),

    path("role/getRoleByUserId/<int:pk>", GetRoleByUserId.as_view(), name="根据用户id查询对应的角色信息"),

    path("role/updateUserRole/", UpdateUserRole.as_view(), name="修改用户权限"),

    path("role/selectRoleById/<int:pk>", SelectRoleById.as_view(), name="修改角色回显"),

    path("role/deleteRoleByIds/", DeleteRoleByIds.as_view(), name="删除角色和角色选择的菜单信息"),

    path("role/changeStatusById/", ChangeStatusById.as_view(), name="修改角色状态"),

    path("role/updateRole/", UpdateRole.as_view(), name="修改角色"),



    # 角色菜单路由
    path("roleMenu/", RoleMenuView.as_view({
        "get": "list",
        "post": "create",
    }), name="roleMenu"),
    path("roleMenu/<int:pk>", RoleMenuView.as_view({
        "get": "retrieve",
        "put": "update",
        "delete": "destroy",
    }), name="roleMenu"),
    path("roleMenu/saveRoleMenu/", SaveRoleMenu.as_view(), name="新增角色和角色选择的菜单信息"),



    path("menu/treeselectMenu/", TreeselectMenu.as_view(), name="获取菜单树接口"),

    # 查询所有菜单父子列表
    path("menu/menuParentChildList/", MenuParentChildList.as_view({
        "get": "list",
    }), name="查询所有菜单父子列表"),

    path("menu/getMenuToML/", GetMenuToML.as_view(), name="获取菜单目录类型"),

    path("menu/saveMenu/", SaveMenu.as_view(), name="新增菜单"),

    path("menu/deleteMenu/", DeleteMenu.as_view(), name="删除菜单"),

    path("menu/updateMenu/", UpdateMenu.as_view(), name="修改菜单"),
]
